#include "reg52.h"
#include "can_func.c"
#include "can_irq.c"

void main()
{
//	 received_data = 300;	//receive data storge at 0x300 in ex_ram //move to test func
	 info	=	0x2000;				//test information storge at 0x2000 in ex_ram
	 
 	 EA =	1;
	 ECAN = 1;
	 ECAN2 = 1;
	 InitCan_Basic(0x43,0x2F,0xAB,0xFF); 	//43,2f is timing setting; AB is mask code
	 InitCan2_Basic(0x43,0x2F,0xAB,0xFF);	//and FF means set all mask bit irrelevant

	 
//	 can_basic_polling_test();	//test trans/receive by polling & IR reg: when interrupt disable, read should be 0xE0
 						        //if test ok, P0 output 'Y'; if failed ,PO output 'N'		
//	 can_basic_irq_test();    //test trans/receive by irq. 
//	 can_basic_id_test();
//	 can_basic_arbitration_test();	 //lost arbitration and re-send
//	 can_basic_remote_test();
//	 can_basic_error_test();
//	 can_basic_fifo_test();
	 can_receive_irq_and_stop_test();

	 //test over
	 test_info("$");
	 P0 = '$';	 	//when testbench read PORT0 = '$', it stops the simulation

	 while(1);
}

